package com.itheima.test;

public class test7 {
    public static void main(String[] args) {
        //把整数上每一位添加到数组中
        //反向推导

        //计算数组长度
        int number = 12345;
        int count = 0;
        int temp = number;
        while(number>0){
            number=number/10;
            count++;
        }

        //需要一个数组
        //动态初始化
        int[] arr = new int[count];

        //把数组上每一位都添加到数组中
        for(int i=arr.length-1;i>=0;i--){
            arr[i] = temp%10;
            temp/= 10;
        }

        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}
